package com.rd.student.ruanjian.class4.zhangrui.day8_8Exam;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class TestStudent {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        StringBuilder sutdent=new StringBuilder();
        for (int i = 1; i <=3; i++) {
            System.out.println("请输入第"+i+"个学生的姓名");
            String name = sc.nextLine();
            System.out.println("请输入第"+i+"个学生的数学成绩");
            int  mathScore=sc.nextInt();
            System.out.println("请输入第"+i+"个学生的语文成绩");
            int  chineseScore=sc.nextInt();
            int totalScore=mathScore+chineseScore;
            sutdent.append("姓名 "+name+" 数学成绩"+mathScore+" 语文成绩"+chineseScore);

        }

        try {
            BufferedWriter writer=new BufferedWriter(new FileWriter("Students.txt"));
              writer.write(sutdent.toString());
              writer.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
}
